#!usr/bin/env python  
# -*- coding:utf-8 _*-
""" 
@author:robot
@file: class_decorator.py 
@version:
@time: 2023/04/28 
"""


class logger(object):
    def __init__(self, level='INFO'):
        self.level = level

    def __call__(self, func):  # 接受函数
        def wrapper(*args, **kwargs):
            print("[{level}]: the function {func}() is running..." \
                  .format(level=self.level, func=func.__name__))
            func(*args, **kwargs)

        return wrapper  # 返回函数


@logger(level='WARNING')
def say(something):
    print("say {}!".format(something))


say("hello")
